#include "MeshManager.h"

MeshManager* MeshManager::sm_pInstance = nullptr;

MeshManager::MeshManager(void)
{

}

MeshManager* MeshManager::GetInstance(void)
{
	if(!sm_pInstance)
		sm_pInstance = new MeshManager;
	return sm_pInstance;
}

void MeshManager::DeleteInstance(void)
{
	if(sm_pInstance)
	{
		delete sm_pInstance;
		sm_pInstance = nullptr;
	}
}

void MeshManager::Initialize(void)
{
}

int MeshManager::LoadMesh(const char* filename)
{
	RenderMesh* mesh = new RenderMesh;
	mesh->Load(filename);

	m_vpMeshes.push_back(mesh);
	return m_vpMeshes.size() - 1;
}

void MeshManager::DrawMesh(int meshID)
{
	if(meshID >= 0 && meshID < (int)m_vpMeshes.size())
	{
		m_vpMeshes[meshID]->Render();
	}
}